#include "graphsupport/graph/FacilitiesGraph.h"

#include <iostream>

#include "accumulsupport/AccumulSupport.h"

FacilitiesGraph::FacilitiesGraph( int citiesCount, int facilitiesCount, AdjCoefType infEdge )
	: BiGraph( citiesCount, facilitiesCount, infEdge )
	, facilitiesPrices( facilitiesCount, getInfEdge() )
{
}

void FacilitiesGraph::initBi( int firstBipart, int secondBipart, AdjCoefType infEdge )
{
	this->BiGraph::initBi( firstBipart, secondBipart, infEdge );
	accumf::reinit( facilitiesPrices, getFacilitiesCount(), getInfEdge() );
}

// TODO: rename getFCEdge
Graph::AdjCoefType FacilitiesGraph::getFSEdge( int city, int facility )
{
	return getAdjacentMatrixArr()[city][facility + firstBipart];
}

void FacilitiesGraph::setFSEdge( int city, int facility, Graph::AdjCoefType coef )
{
	getAdjacentMatrixArr()[city][facility + firstBipart] = coef;
}

int FacilitiesGraph::getCitiesCount()
{
	return firstBipart;
}

int FacilitiesGraph::getFacilitiesCount()
{
	return secondBipart;
}
